}
}
+GBool BitmapOutputDev::checkPageSlice(Page *page, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool crop,
+ int sliceX, int sliceY, int sliceW, int sliceH,
+ GBool printing, Catalog *catalog,
+ GBool (*abortCheckCbk)(void *data),
+ void *abortCheckCbkData)
+{
+ this->setPage(page);
+ gfxdev->setPage(page);
+ return gTrue;
+}
-void BitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
+void BitmapOutputDev::startPage(int pageNum, GfxState *state)
{
+ PDFRectangle *r = this->page->getCropBox();
double x1,y1,x2,y2;
- state->transform(crop_x1,crop_y1,&x1,&y1);
- state->transform(crop_x2,crop_y2,&x2,&y2);
+ state->transform(r->x1,r->y1,&x1,&y1);
+ state->transform(r->x2,r->y2,&x2,&y2);
if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
this->width = (int)(x2-x1);
this->height = (int)(y2-y1);
- rgbdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
- boolpolydev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
- booltextdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
- clip0dev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
- clip1dev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
- gfxdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
+ rgbdev->startPage(pageNum, state);
+ boolpolydev->startPage(pageNum, state);
+ booltextdev->startPage(pageNum, state);
+ clip0dev->startPage(pageNum, state);
+ clip1dev->startPage(pageNum, state);
+ gfxdev->startPage(pageNum, state);
boolpolybitmap = boolpolydev->getBitmap();
stalepolybitmap = new SplashBitmap(boolpolybitmap->getWidth(), boolpolybitmap->getHeight(), 1, boolpolybitmap->getMode(), 0);
clip1dev->needNonText();
return rgbdev->needNonText();
}
-/*GBool BitmapOutputDev::checkPageSlice(Page *page, double hDPI, double vDPI,
- int rotate, GBool useMediaBox, GBool crop,
- int sliceX, int sliceY, int sliceW, int sliceH,
- GBool printing, Catalog *catalog,
- GBool (*abortCheckCbk)(void *data),
- void *abortCheckCbkData)
-{
- return gTrue;
-}*/
void BitmapOutputDev::setDefaultCTM(double *ctm)
{
boolpolydev->setDefaultCTM(ctm);
virtual GBool interpretType3Chars();
virtual GBool needNonText();
virtual void setDefaultCTM(double *ctm);
-/* virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
+ virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool (*abortCheckCbk)(void *data) = NULL,
- void *abortCheckCbkData = NULL);*/
+ void *abortCheckCbkData = NULL);
- virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
+ virtual void startPage(int pageNum, GfxState *state);
virtual void endPage();
virtual void finishPage();
#define __commonoutputdev_h__
#include "OutputDev.h"
+#include "../gfxdevice.h"
#define RENDER_FILL 0
#define RENDER_STROKE 1
virtual void setParameter(const char*key, const char*value) = 0;
virtual void setPageMap(int*pagemap, int pagemap_len) = 0;
+ virtual void setPage(Page *page) { this->page = page; }
virtual void finishPage() {};
+
+ virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool crop,
+ int sliceX, int sliceY, int sliceW, int sliceH,
+ GBool printing, Catalog *catalog,
+ GBool (*abortCheckCbk)(void *data) = NULL,
+ void *abortCheckCbkData = NULL)
+ {
+ this->setPage(page);
+ return gTrue;
+ }
+
+ protected:
+ Page *page;
};
#endif //__deviceinterface_h__
delete this->rgbdev;this->rgbdev= 0;
}
}
-void DummyOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
+void DummyOutputDev::startPage(int pageNum, GfxState *state)
{
- rgbdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
+ rgbdev->startPage(pageNum, state);
}
void DummyOutputDev::endPage()
GBool (*abortCheckCbk)(void *data) = NULL,
void *abortCheckCbkData = NULL);*/
- virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
+ virtual void startPage(int pageNum, GfxState *state);
virtual void endPage();
virtual void saveState(GfxState *state);
free(img->data);img->data=0;free(img);img=0;
}
-void FullBitmapOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
+GBool FullBitmapOutputDev::checkPageSlice(Page *page, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool crop,
+ int sliceX, int sliceY, int sliceW, int sliceH,
+ GBool printing, Catalog *catalog,
+ GBool (*abortCheckCbk)(void *data),
+ void *abortCheckCbkData)
+{
+ this->setPage(page);
+ gfxdev->setPage(page);
+ return gTrue;
+}
+
+void FullBitmapOutputDev::startPage(int pageNum, GfxState *state)
{
double x1,y1,x2,y2;
- state->transform(crop_x1,crop_y1,&x1,&y1);
- state->transform(crop_x2,crop_y2,&x2,&y2);
+ PDFRectangle *r = page->getCropBox();
+ state->transform(r->x1,r->y1,&x1,&y1);
+ state->transform(r->x2,r->y2,&x2,&y2);
if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
this->height = (int)(y2-y1);
msg("<debug> startPage");
- rgbdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
- gfxdev->startPage(pageNum, state, crop_x1, crop_y1, crop_x2, crop_y2);
+ rgbdev->startPage(pageNum, state);
+ gfxdev->startPage(pageNum, state);
}
void FullBitmapOutputDev::endPage()
virtual GBool interpretType3Chars();
virtual GBool needNonText();
virtual void setDefaultCTM(double *ctm);
-/* virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
+ virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool (*abortCheckCbk)(void *data) = NULL,
- void *abortCheckCbkData = NULL);*/
+ void *abortCheckCbkData = NULL);
- virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
+ virtual void startPage(int pageNum, GfxState *state);
virtual void endPage();
virtual void saveState(GfxState *state);
msg("<debug> endType3Char");
}
-void GFXOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
+void GFXOutputDev::startPage(int pageNum, GfxState *state)
{
this->currentpage = pageNum;
double x1,y1,x2,y2;
gfxcolor_t black = {255,0,0,0};
laststate = state;
gfxline_t clippath[5];
+ PDFRectangle *r = this->page->getCropBox();
/* state->transform(state->getX1(),state->getY1(),&x1,&y1);
state->transform(state->getX2(),state->getY2(),&x2,&y2);
y1 = crop_y1;
x2 = crop_x2;
y2 = crop_y2;*/
- state->transform(crop_x1,crop_y1,&x1,&y1); //x1 += user_movex; y1 += user_movey;
- state->transform(crop_x2,crop_y2,&x2,&y2); //x2 += user_movex; y2 += user_movey;
+ state->transform(r->x1,r->y1,&x1,&y1); //x1 += user_movex; y1 += user_movey;
+ state->transform(r->x2,r->y2,&x2,&y2); //x2 += user_movex; y2 += user_movey;
if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
virtual void setParameter(const char*key, const char*value);
// Start a page.
- virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ;
+ virtual void startPage(int pageNum, GfxState *state);
virtual void endPage();
//----- get info about output device
GBool InfoOutputDev::interpretType3Chars() {return gTrue;}
GBool InfoOutputDev::useTilingPatternFill() {return gTrue;}
-void InfoOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2)
+GBool InfoOutputDev::checkPageSlice(Page *page, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool crop,
+ int sliceX, int sliceY, int sliceW, int sliceH,
+ GBool printing, Catalog *catalog,
+ GBool (*abortCheckCbk)(void *data),
+ void *abortCheckCbkData)
{
+ this->page = page;
+ return gTrue;
+}
+
+void InfoOutputDev::startPage(int pageNum, GfxState *state)
+{
+ PDFRectangle *r = this->page->getCropBox();
double x1,y1,x2,y2;
- state->transform(crop_x1,crop_y1,&x1,&y1);
- state->transform(crop_x2,crop_y2,&x2,&y2);
+ state->transform(r->x1,r->y1,&x1,&y1);
+ state->transform(r->x2,r->y2,&x2,&y2);
if(x2<x1) {double x3=x1;x1=x2;x2=x3;}
if(y2<y1) {double y3=y1;y1=y2;y2=y3;}
this->x1 = (int)x1;
#include "GfxFont.h"
#include "OutputDev.h"
#include "SplashOutputDev.h"
+#include "Page.h"
#ifdef HAVE_POPPLER
#include <splash/SplashTypes.h>
#include <splash/SplashPath.h>
FontInfo* currentfont;
GlyphInfo* currentglyph;
SplashOutputDev*splash;
+ Page *page;
public:
int x1,y1,x2,y2;
virtual GBool upsideDown();
virtual GBool useDrawChar();
virtual GBool interpretType3Chars();
- virtual void startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2);
+ virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool crop,
+ int sliceX, int sliceY, int sliceW, int sliceH,
+ GBool printing, Catalog *catalog,
+ GBool (*abortCheckCbk)(void *data) = NULL,
+ void *abortCheckCbkData = NULL);
+ virtual void startPage(int pageNum, GfxState *state);
virtual void endPage();
virtual void drawLink(Link *link, Catalog *catalog);
virtual double getMaximumFontSize(char*id);
fclose(out);
}
-void XMLOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2)
+void XMLOutputDev::startPage(int pageNum, GfxState *state)
{
- TextOutputDev::startPage(pageNum, state, x1, y1, x2, y2);
+ TextOutputDev::startPage(pageNum, state);
fprintf(out, "<page nr=\"%d\" width=\"%.0f\" height=\"%.0f\">\n", pageNum,
state->getPageWidth(), state->getPageHeight());
}
{
public:
XMLOutputDev(char*filename);
- virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
+ virtual void startPage(int pageNum, GfxState *state);
virtual void endPage();
virtual ~XMLOutputDev();
private:
for (i = oldLen; i < mapLen; ++i) {
map[i] = 0;
}
---- xpdf/CoreOutputDev.cc.orig 2010-05-18 11:22:18.000000000 -0700
-+++ xpdf/CoreOutputDev.cc 2010-05-18 11:22:18.000000000 -0700
-@@ -57,5 +57,5 @@
-
- void CoreOutputDev::clear() {
- startDoc(NULL);
-- startPage(0, NULL);
-+ startPage(0, NULL, 0,0,0,0);
- }
--- xpdf/Decrypt.cc.orig 2010-05-18 11:22:18.000000000 -0700
+++ xpdf/Decrypt.cc 2010-05-18 11:22:18.000000000 -0700
@@ -596,6 +596,7 @@
}
--- xpdf/Gfx.cc.orig 2010-05-18 11:22:18.000000000 -0700
+++ xpdf/Gfx.cc 2010-05-18 11:22:18.000000000 -0700
-@@ -454,7 +454,11 @@
- fontChanged = gFalse;
- clip = clipNone;
- ignoreUndef = 0;
-- out->startPage(pageNum, state);
-+ if(cropBox) {
-+ out->startPage(pageNum, state, cropBox->x1,cropBox->y1,cropBox->x2,cropBox->y2);
-+ } else {
-+ out->startPage(pageNum, state, 0,0,0,0);
-+ }
- out->setDefaultCTM(state->getCTM());
- out->updateAll(state);
- for (i = 0; i < 6; ++i) {
@@ -465,6 +469,7 @@
abortCheckCbkData = abortCheckCbkDataA;
class GString;
class GfxState;
-@@ -94,7 +95,7 @@
- { return gTrue; }
-
- // Start a page.
-- virtual void startPage(int pageNum, GfxState *state) {}
-+ virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
-
- // End a page.
- virtual void endPage() {}
--- xpdf/SplashFTFont.cc.orig 2010-05-18 11:22:18.000000000 -0700
+++ xpdf/SplashFTFont.cc 2010-05-18 11:22:18.000000000 -0700
@@ -46,6 +46,7 @@
#include <math.h>
#include "gfile.h"
#include "GlobalParams.h"
-@@ -702,7 +703,7 @@
- nT3Fonts = 0;
- }
-
--void SplashOutputDev::startPage(int pageNum, GfxState *state) {
-+void SplashOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
- int w, h;
- double *ctm;
- SplashCoord mat[6];
@@ -2646,9 +2647,9 @@
softMask = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(),
tBitmap->getPixel(x, y, color);
--- xpdf/SplashOutputDev.h.orig 2010-05-18 11:22:18.000000000 -0700
+++ xpdf/SplashOutputDev.h 2010-05-18 11:22:18.000000000 -0700
-@@ -70,7 +70,7 @@
- //----- initialization and control
-
- // Start a page.
-- virtual void startPage(int pageNum, GfxState *state);
-+ virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
-
- // End a page.
- virtual void endPage();
@@ -196,6 +196,9 @@
virtual void setVectorAntialias(GBool vaa);
#endif
};
//------------------------------------------------------------------------
---- xpdf/TextOutputDev.cc.orig 2010-05-18 11:22:18.000000000 -0700
-+++ xpdf/TextOutputDev.cc 2010-05-18 11:22:18.000000000 -0700
-@@ -3877,7 +3877,7 @@
- }
- }
-
--void TextOutputDev::startPage(int pageNum, GfxState *state) {
-+void TextOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
- text->startPage(state);
- }
-
--- xpdf/TextOutputDev.h.orig 2010-05-18 11:22:18.000000000 -0700
+++ xpdf/TextOutputDev.h 2010-05-18 11:22:18.000000000 -0700
@@ -170,6 +170,7 @@
};
//------------------------------------------------------------------------
-@@ -578,7 +579,7 @@
- //----- initialization and control
-
- // Start a page.
-- virtual void startPage(int pageNum, GfxState *state);
-+ virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
-
- // End a page.
- virtual void endPage();
--- xpdf/gfile.cc.orig 2010-05-18 11:22:18.000000000 -0700
+++ xpdf/gfile.cc 2010-05-18 11:22:18.000000000 -0700
@@ -439,6 +439,52 @@